layui.define(['table', 'form'], function(exports){
  var $ = layui.$,table = layui.table,form = layui.form;

  var userId = $('input[name="userId"]').val();
  var accountGroupId = $('input[name="accountGroupId"]').val();

    table.render({
        elem: '#LAY-table'
        ,url: layui.setter.webRoot + '/user/wallet/operate/list.data'
        ,where:{userId:userId,accountGroupId:accountGroupId}
        ,method: 'post'
        ,parseData: function (res) {
            return {
                "code": res.code,
                "msg": res.msg,
                "count": res.body.total,
                "data": res.body.data
            };
        }
        ,response: {statusCode: 200}
        ,cols: [[
            {field: 'createDate', title: '操作时间'}
            ,{field: 'typeName', title:'操作类型'}
            ,{field: 'moneyTypeName', title: '金钱类型'}
            ,{field: 'moneyStr', title: '金额'}
            ,{field: 'operateNote', title:'操作说明'}
            ,{field: 'operator', title: '操作用户',templet:function (record){
                    return '['+record.operatorTypeName+']' + record.operator;
                }}
        ]]
        ,page: true
        ,height: 'full'
        ,text: '对不起，加载出现异常！'
    });
	
	//监听搜索
    form.on('submit(LAY-search)', function (data) {
        var field = data.field;
        //执行重载
        table.reload('LAY-table', {
            where: field
            , page: {curr: 1}
        });
    });

  exports('user_wallet_operate_record', {})
});